package com.wntms.ywa.dao;

import com.wntms.ywa.pojo.AddNew;
import com.wntms.ywa.pojo.Aid;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

//新增货运单
@Mapper
public interface AddDao {

 @Insert("insert into customer_in (id,name,address,tel) values(#{id},#{rname},#{raddress},#{rtel})")
 public void addCustomerIn(AddNew addNew);

 @Insert("insert into customer_information (id,tel,address,name) values(#{id},#{ptel},#{paddress},#{pname})")
 public void addCustomerInformation(AddNew addNew);


//获取最新的id
 @Select("select id from freight_contract where id = (select max(id) from freight_contract)")
 public Aid findMaxId();
 // id对应
 @Update("update freight_contract set fiid = #{id},uid= #{id},coid = #{id},flid = #{id},fsid = #{id} where id = #{id}")
 public void updateFreightContract(Integer id);


 @Insert("insert into freight_contract (id,fid,pay,sdate,payment,refundtype,occurtime,auditstatus,fiid,uid,coid,flid,fsid,fare,insurancefare) values(#{id},#{fid},#{pay},#{sdate},#{payment},#{refundtype},#{occurtime},#{auditstatus},#{fiid},#{uid},#{coid},#{flid},#{fsid},#{fare},#{insurancefare})")
 public void addFreightContract(AddNew addNew);



 @Insert("insert into freight_information (id,weight,volume,breakable,freightvalue) values(#{id},#{weight},#{volume},#{breakable},#{freightvalue})")
 public void addFreightInformation(AddNew addNew);

 @Insert("insert into freight_line (id,distance,arrivetime) values(#{id},#{distance},#{arrivetime})")
 public void addFreightLine(AddNew addNew);

 @Insert("insert into freight_status (id,status,receive_address,iscollection) values(#{id},#{status},#{paddress},#{iscollection} )")
 public void addFreightStatus(AddNew addNew);
}
